<?php
class PublicController extends Controller {
    
    private $_model;
    
    public function actionIndex($id){
        $model=$this->loadModel($id);
                
        $this->render('index',array(
            'user'=>$model,
        ));
    }
    
    public function loadModel($id = null) {
        if ($this->_model === null) {
            if (!empty($id)) {
                $this->_model = User::model()->active()->findByPk((int) $id);
            }
            if ($this->_model === null)
                HttpStatus::code(404);
        }
        return $this->_model;
    }
        
}